/* 
 * Copyright (c)	Insighten Intelligent Equipment co.,LTD
 * 
 *  Use of this software is controlled by the terms and conditions found
 *  in the license agreement under which this software has been supplied.
 * 
 */
/** 
 * @file communication.h
 * @brief header file for communication module
 * @author taco [tacoee@gmail.com]
 * @version 0.1
 * @date 2010-09-14
 */
#ifndef COMMUNICATION_H_
#define COMMUNICATION_H_


struct _CommObj;

typedef struct _CommObj CommObj;

typedef enum _MsgCmd {
	MSG_CMD_START = 0,
	/*FIXME will add more command here*/
	MSG_CMD_END
} MsgCmd;

typedef int	(*FunDataProc)(RwBuf **inbuf, RwBuf **outbuf, MsgCmd cmd);

CommObj *comm_obj_create(int m_key, int s_key, int s_size);
Ret comm_obj_destory(CommObj *thiz);
CommObj *comm_obj_open(CommObj *thiz, int m_key, int s_key, int s_size);
Ret comm_obj_set_msg_type(CommObj *thiz, long lmtype, long rmtype);
Ret comm_obj_close(CommObj *thiz);
Ret comm_obj_rcv_snd(CommObj *thiz, FunDataProc data_proc);
Ret comm_obj_snd_rcv(CommObj *thiz, FunDataProc data_proci, RwBuf *original);
#endif /*COMMUNICATION_H_*/

